#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>


int val=0;

int main()
{
    pid_t re=fork();
    
    if(re>0)
    {
        while(1)
        {
            printf("我是父进程val:%d &val:%p\n",val,&val);
            sleep(1);
        }
    }
    else if(re==0)
    {
        while(1)
        {

            printf("我是子进程val:%d &val:%p\n",val,&val);
            sleep(1);
            val++;
        }
    }

    return 0;
}
